package com.tjbklx1.zk.testzkclient;

import java.util.List;

import org.I0Itec.zkclient.ZkClient;
import org.I0Itec.zkclient.serialize.SerializableSerializer;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.data.Stat;

public class GetChild {

	public static void main(String[] args) {
		ZkClient zc = new ZkClient("127.0.0.1:2181",10000,10000,new SerializableSerializer());
		System.out.println("conneted ok!");
		
		//获取节点信息
		User u = zc.readData("/cli");
		System.out.println(u);
		System.out.println(u.getName());
		
//		Stat stat = new Stat();
//		User u2 = zc.readData("/cli",stat);
//		System.out.println(stat);
//		System.out.println(u2);
//		System.out.println(u2.getName());
//		
//		//获取子节点信息
//		List<String> cList = zc.getChildren("/cli");
//		System.out.println(cList.toString());
//		
//		//节点是否存在
//		boolean e = zc.exists("/jike5");
//		System.out.println(e);
//		
//		//删除节点
//		boolean e1 = zc.delete("/node_1");
//		boolean e2 = zc.deleteRecursive("/node_1");
//		System.out.println(e1);
//		System.out.println(e2);
	}
	
}